home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97b.txt
/
000094_icon-group-sender _Fri Oct 24 08:39:33 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by cheltenham.cs.arizona.edu (8.8.7/8.8.7) with SMTP id IAA26551
for <icon-group-addresses@cheltenham.CS.Arizona.EDU>; Fri, 24 Oct 1997 08:39:33 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA24456; Fri, 24 Oct 1997 08:39:32 -0700
To: icon-group@cs.arizona.edu
Date: Fri, 24 Oct 1997 12:58:06 +1000
From: Stuart.Robinson@anu.edu.au (Stuart Robinson)
Message-Id: <Stuart.Robinson-2410971258070001@asianstmg-229.anu.edu.au>
Organization: ANU
Sender: icon-group-request@cs.arizona.edu
References: <Stuart.Robinson-2410970146220001@asianstmg-229.anu.edu.au>
Subject: Re: tabulating values
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Well, I've now received six responses to my query, none of which provide a
solution to the problem. I really do appreciate the responses, but four
of the responses consisted of people essentially saying "Heck, that's
trivial" without proving it by actually providing a working solution and
the two responses that did actually contain code failed to provide a
solution. Here they are:
PROGRAM #1
----------
procedure main()
t := table(0)
while t[!read()] +:= 1
write("value n")
every i := !sort(t) do write(left(i[1], 9), left(i[2], 4))
end
PROGRAM #2
----------
procedure main()
count := table(0)
every n := read() do
count[n] +:= 1
write("value\tn")
every n := key(count) do
write(n, "\t", count[n])
end
Assume the following input (note that the last three values are two and
three digit figures):
1
2
3
10
10
100
The output I'd like would be something like the following:
1 1
2 1
3 1
10 2
100 1
Here is what each of the above-listed programs actually outputs:
OUTPUT OF PROGRAM #1
--------------------
value n
1 4
2 1
3 1
OUTPUT OF PROGRAM #2
--------------------
value n
1 1
--
Stuart Robinson <Stuart.Robinson@nospam.anu.edu.au>
The Australian National University
*TO REPLY, REMOVE "nospam." FROM E-MAIL ADDRESS GIVEN ABOVE